home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / transimg / bounce.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-08-02  |  8.1 KB  |  251 lines

  1. VERSION 5.00
  2. Object = "{50CBA22D-9024-11D1-AD8F-8E94A5273767}#8.5#0"; "TranImg2.ocx"
  3. Begin VB.Form frmBounce 
  4.    BackColor       =   &H00FFFFFF&
  5.    Caption         =   "TransImg Animated Bounce Example"
  6.    ClientHeight    =   1512
  7.    ClientLeft      =   48
  8.    ClientTop       =   276
  9.    ClientWidth     =   4104
  10.    Icon            =   "Bounce.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    Picture         =   "Bounce.frx":0442
  13.    ScaleHeight     =   126
  14.    ScaleMode       =   3  'Pixel
  15.    ScaleWidth      =   342
  16.    StartUpPosition =   1  'CenterOwner
  17.    Begin VB.Timer Timer1 
  18.       Interval        =   10
  19.       Left            =   3696
  20.       Top             =   792
  21.    End
  22.    Begin VB.PictureBox Pic 
  23.       AutoSize        =   -1  'True
  24.       BorderStyle     =   0  'None
  25.       Height          =   384
  26.       Index           =   7
  27.       Left            =   3228
  28.       Picture         =   "Bounce.frx":1CC78
  29.       ScaleHeight     =   384
  30.       ScaleWidth      =   384
  31.       TabIndex        =   8
  32.       Top             =   1092
  33.       Visible         =   0   'False
  34.       Width           =   384
  35.    End
  36.    Begin VB.PictureBox Pic 
  37.       AutoSize        =   -1  'True
  38.       BorderStyle     =   0  'None
  39.       Height          =   384
  40.       Index           =   6
  41.       Left            =   2784
  42.       Picture         =   "Bounce.frx":1D8BA
  43.       ScaleHeight     =   384
  44.       ScaleWidth      =   384
  45.       TabIndex        =   7
  46.       Top             =   1092
  47.       Visible         =   0   'False
  48.       Width           =   384
  49.    End
  50.    Begin VB.PictureBox Pic 
  51.       AutoSize        =   -1  'True
  52.       BorderStyle     =   0  'None
  53.       Height          =   384
  54.       Index           =   5
  55.       Left            =   2328
  56.       Picture         =   "Bounce.frx":1E4FC
  57.       ScaleHeight     =   384
  58.       ScaleWidth      =   384
  59.       TabIndex        =   6
  60.       Top             =   1092
  61.       Visible         =   0   'False
  62.       Width           =   384
  63.    End
  64.    Begin VB.PictureBox Pic 
  65.       AutoSize        =   -1  'True
  66.       BorderStyle     =   0  'None
  67.       Height          =   384
  68.       Index           =   4
  69.       Left            =   1884
  70.       Picture         =   "Bounce.frx":1F13E
  71.       ScaleHeight     =   384
  72.       ScaleWidth      =   384
  73.       TabIndex        =   5
  74.       Top             =   1092
  75.       Visible         =   0   'False
  76.       Width           =   384
  77.    End
  78.    Begin VB.PictureBox Pic 
  79.       AutoSize        =   -1  'True
  80.       BorderStyle     =   0  'None
  81.       Height          =   384
  82.       Index           =   3
  83.       Left            =   1440
  84.       Picture         =   "Bounce.frx":1FD80
  85.       ScaleHeight     =   384
  86.       ScaleWidth      =   384
  87.       TabIndex        =   4
  88.       Top             =   1092
  89.       Visible         =   0   'False
  90.       Width           =   384
  91.    End
  92.    Begin VB.PictureBox Pic 
  93.       AutoSize        =   -1  'True
  94.       BorderStyle     =   0  'None
  95.       Height          =   384
  96.       Index           =   2
  97.       Left            =   996
  98.       Picture         =   "Bounce.frx":209C2
  99.       ScaleHeight     =   384
  100.       ScaleWidth      =   384
  101.       TabIndex        =   3
  102.       Top             =   1092
  103.       Visible         =   0   'False
  104.       Width           =   384
  105.    End
  106.    Begin VB.PictureBox Pic 
  107.       AutoSize        =   -1  'True
  108.       BorderStyle     =   0  'None
  109.       Height          =   384
  110.       Index           =   1
  111.       Left            =   552
  112.       Picture         =   "Bounce.frx":21604
  113.       ScaleHeight     =   384
  114.       ScaleWidth      =   384
  115.       TabIndex        =   2
  116.       Top             =   1092
  117.       Visible         =   0   'False
  118.       Width           =   384
  119.    End
  120.    Begin VB.PictureBox Pic 
  121.       AutoSize        =   -1  'True
  122.       BorderStyle     =   0  'None
  123.       Height          =   384
  124.       Index           =   0
  125.       Left            =   108
  126.       Picture         =   "Bounce.frx":22246
  127.       ScaleHeight     =   384
  128.       ScaleWidth      =   384
  129.       TabIndex        =   1
  130.       Top             =   1092
  131.       Visible         =   0   'False
  132.       Width           =   384
  133.    End
  134.    Begin DevPowerTransImg.TransImg TransImg1 
  135.       Height          =   384
  136.       Left            =   336
  137.       TabIndex        =   0
  138.       Top             =   120
  139.       Width           =   384
  140.       _ExtentX        =   677
  141.       _ExtentY        =   677
  142.       MaskColor       =   12434877
  143.       Transparent     =   -1  'True
  144.       Picture         =   "Bounce.frx":22E88
  145.    End
  146.    Begin VB.Label lblMessage 
  147.       Alignment       =   2  'Center
  148.       BackStyle       =   0  'Transparent
  149.       Caption         =   "Chase the moon with your mouse."
  150.       BeginProperty Font 
  151.          Name            =   "Tahoma"
  152.          Size            =   7.8
  153.          Charset         =   0
  154.          Weight          =   400
  155.          Underline       =   0   'False
  156.          Italic          =   0   'False
  157.          Strikethrough   =   0   'False
  158.       EndProperty
  159.       ForeColor       =   &H00000080&
  160.       Height          =   192
  161.       Left            =   720
  162.       TabIndex        =   10
  163.       Top             =   876
  164.       Width           =   2592
  165.    End
  166.    Begin VB.Label lblTitle 
  167.       Alignment       =   2  'Center
  168.       AutoSize        =   -1  'True
  169.       BackStyle       =   0  'Transparent
  170.       Caption         =   "DevPower TransImg Bounce"
  171.       BeginProperty Font 
  172.          Name            =   "Tahoma"
  173.          Size            =   12
  174.          Charset         =   0
  175.          Weight          =   700
  176.          Underline       =   0   'False
  177.          Italic          =   0   'False
  178.          Strikethrough   =   0   'False
  179.       EndProperty
  180.       ForeColor       =   &H00000080&
  181.       Height          =   288
  182.       Left            =   288
  183.       TabIndex        =   9
  184.       Top             =   540
  185.       Width           =   3456
  186.    End
  187. Attribute VB_Name = "frmBounce"
  188. Attribute VB_GlobalNameSpace = False
  189. Attribute VB_Creatable = False
  190. Attribute VB_PredeclaredId = True
  191. Attribute VB_Exposed = False
  192. Private iCurr As Integer
  193. Private bDown As Boolean
  194. Private bRight As Boolean
  195. Private iMsg As Integer
  196. Private bChangeMsg As Boolean
  197. Private Sub Form_Load()
  198.     TransImg1.ZOrder
  199.     bDown = True
  200.     bRight = True
  201. End Sub
  202. Private Sub Form_Resize()
  203.     lblTitle.Top = (Me.ScaleHeight - lblTitle.Height - lblMessage.Height - 2) / 2
  204.     lblTitle.Left = (Me.ScaleWidth - lblTitle.Width) / 2
  205.     lblMessage.Top = lblTitle.Top + lblTitle.Height + 2
  206.     lblMessage.Left = 0
  207.     lblMessage.Width = Me.ScaleWidth
  208.     If bDown And (TransImg1.Top + TransImg1.Height > Me.ScaleHeight) Then TransImg1.Top = Me.ScaleHeight - TransImg1.Height
  209.     If bRight And (TransImg1.Left + TransImg1.Width > Me.ScaleWidth) Then TransImg1.Left = Me.ScaleWidth - TransImg1.Width
  210. End Sub
  211. Private Sub Timer1_Timer()
  212.     Dim iDX As Integer, iDY As Integer
  213.     If iCurr > 7 Then iCurr = 0
  214.     Set TransImg1.Picture = Pic(iCurr).Picture
  215.     iCurr = iCurr + 1
  216.     ' Still going down?
  217.     If TransImg1.Top + TransImg1.Height > Me.ScaleHeight Then bDown = False
  218.     If TransImg1.Top < 0 Then bDown = True
  219.     ' Still going right?
  220.     If TransImg1.Left + TransImg1.Width > Me.ScaleWidth Then bRight = False
  221.     If TransImg1.Left < 0 Then bRight = True
  222.     If bDown Then
  223.         iDY = 2
  224.     Else
  225.         iDY = -2
  226.     End If
  227.     If bRight Then
  228.         iDX = 2
  229.     Else
  230.         iDX = -2
  231.     End If
  232.         
  233.     TransImg1.Move TransImg1.Left + iDX, TransImg1.Top + iDY
  234. End Sub
  235. Private Sub TransImg1_Click()
  236.     Timer1.Enabled = Not Timer1.Enabled
  237. End Sub
  238. Private Sub TransImg1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
  239.     iMsg = iMsg + 1
  240.     If iMsg > 300 Then iMsg = 1
  241.     If iMsg < 50 Then
  242.         lblMessage.Caption = "Chase the moon with your mouse."
  243.     ElseIf iMsg < 75 Then
  244.         lblMessage.Caption = "Click to stop and start animation."
  245.     ElseIf iMsg < 150 Then
  246.         lblMessage.Caption = "Demo of transparency and ... "
  247.     ElseIf iMsg < 225 Then
  248.         lblMessage.Caption = "improved display for animation purposes"
  249.     End If
  250. End Sub
  251.